package com.syf.starter.config;

import com.syf.core.engine.SyFrameContext;
import com.syf.starter.core.SyHttpServer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SyHttpServerConfiguration.class)
public class SyHttpServerStarterAutoConfig {

    @ConditionalOnMissingBean(SyHttpServer.class)
    @Bean
    SyHttpServer createSyHttpServer(SyHttpServerConfiguration configuration, SyFrameContext syFrameContext) {
        return new SyHttpServer(configuration, syFrameContext);
    }
}
